/**
 * Author: Dmitry Ustimov
 * Date: 6/1/13
 * Time: 10:08 PM
 */

package com.gmail.dmitryustimov.ms.java7.chain_of_responsibility.mod.mod_multy_type_actionmap.demo.handlers1_100_requests10;

import com.gmail.dmitryustimov.ms.java7.patternslib.chain_of_responsibility.multyevent.Handler;

public class Demo {

    private static final int NUM_HANDLERS = 100;

    public static void main(String[] args) {

        Handler<Request> h1 = new CocreteHandler1<>("CocreteHandler1", 10);
        Handler beforeNext = h1;

        for (int i = 1; i < NUM_HANDLERS; i++) {
            Handler<Request> next = new CocreteHandler1<>("CocreteHandler" + (i + 1), 10);
            beforeNext.setNext(next);
            beforeNext = next;
        }

        Request request1 = new Request1("Request1", 5);
        Request request2 = new Request2("Request2", 5);
        Request request3 = new Request3("Request3", 5);
        Request request4 = new Request4("Request4", 5);
        Request request5 = new Request5("Request5", 5);
        Request request6 = new Request6("Request6", 5);
        Request request7 = new Request7("Request7", 5);
        Request request8 = new Request8("Request8", 5);
        Request request9 = new Request9("Request9", 5);
        Request request10 = new Request10("Request10", 5);

        h1.handleChain(request1);
        h1.handleChain(request2);
        h1.handleChain(request3);
        h1.handleChain(request4);
        h1.handleChain(request5);
        h1.handleChain(request6);
        h1.handleChain(request7);
        h1.handleChain(request8);
        h1.handleChain(request9);
        h1.handleChain(request10);
    }
}
